<template>
	<view class="posterDialog" v-if="visible">
		<view class="posterDialog-main">
			<view class="posterDialog-close" @tap="$emit('close')">
				<image class="posterDialog-img" src="/static/img/close.png" />
			</view>
			<view class="posterDialog-content">
				<image class="posterDialog-content-img" :src="posterpic" mode="widthFix" @tap="previewImage"
					:data-url="posterpic"></image>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	
	export default {
		props: {
			visible: Boolean,
			current: Object,
		},
		data() {
			return {
				posterpic: ''
			}
		},
		watch: {
			visible(val) {
				this.posterpic = ''
				if (val) this.genPoster()
			}
		},
		methods: {
			genPoster() {
				app.showLoading('生成海报中');
				app.post('ApiShortvideo/getposter', {
					id: this.current.id
				}, (data) => {
					app.showLoading(false);
					if (data.status == 0) {
						app.alert(data.msg);
					} else {
						this.posterpic = data.poster;
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.posterDialog {
		position: absolute;
		z-index: 999999;
		width: 750rpx;
		bottom: 0;
		align-items: center;
		justify-content: center;
		// height: 900rpx;
		// top: 100rpx;
		// left: 0
	}
	
	.posterDialog-main {
		// width: 670rpx;
		// height: 1100rpx;
		// margin: 60rpx 40rpx 30rpx 40rpx;
		background: #fff;
		position: relative;
		border-radius: 20rpx;
		display: flex
	}
	
	.posterDialog-close {
		position: absolute;
		padding: 20rpx;
		top: 0;
		right: 0;
		z-index: 10;
	}
	
	.posterDialog-img {
		width: 40rpx;
		height: 40rpx;
	}
	
	.posterDialog-content {
		flex: 1;
		padding: 70rpx 20rpx 30rpx 20rpx;
		color: #333;
		font-size: 30rpx;
		text-align: center;
		display: flex;
		height: 810rpx;
	}
	
	.posterDialog-content-img {
		// flex: 1;
		width: 560rpx;
		height: 770rpx;
	}
</style>